package com.dac.learn.springboot.validation.user;

import com.dac.learn.springboot.validation.validator.DateTimeStr;
import jakarta.validation.constraints.*;
import lombok.Data;

/**
 * @author yangdc
 * @date 2025/8/27
 */
@Data
public class UserDTO {

    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度必须在3到20个字符之间")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, message = "密码长度不能少于6位")
    @Pattern(regexp = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*_]).{6,}$",
            message = "密码必须包含大小写字母、数字和特殊字符，且长度至少为6位")
    private String password;

    @Min(value = 18, message = "年龄不能小于18岁")
    @Max(value = 120, message = "年龄不能大于120岁")
    @NotNull(message = "年龄不能为空")
    private Integer age;

    @Email(message = "邮箱格式不正确")
    @NotBlank(message = "邮箱不能为空")
    private String email;

    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$",
            message = "手机号格式不正确")
    @NotBlank(message = "手机号不能为空")
    private String phoneNumber;

    /**
     * 银行通知客户临柜时间(必填)
     */
    @NotBlank(message="银行通知客户临柜时间不能为空")
    @DateTimeStr(format ="yyyy-MM-dd HH:mm:ss", message = "格式错误，正确格式为：yyyy-MM-dd HH:mm:ss")
    private String bankApplyTime;
}

